#include <iostream>
#include <vector>

using namespace std;

// https://leetcode.cn/problems/permutations/?envType=problem-list-v2&envId=z8Em6vKo
// 46. 全排列

class Solution {
public:
    void recursionTry(vector<vector<int>> &ans, int curIndex, vector<int> &nums){
        if(curIndex == nums.size()){
            ans.push_back(nums);
            return;
        }
        for (int j = curIndex; j < nums.size(); j++){
            swap(nums[j], nums[curIndex]);
            recursionTry(ans, curIndex + 1 , nums);
            swap(nums[j], nums[curIndex]);
        }
    }
    vector<vector<int>> permute(vector<int>& nums) {
        vector<vector<int>> ans;
        recursionTry(ans, 0, nums);
        return ans;
    }
};

int main()
{
    return 0;
}